#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QMap>
#include <QString>

class List;

class QAction;
class QFileInfo;

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void setList(
        List *list
    ,   QFileInfo *file = NULL);

    void setModified(const bool modified);

    void save(QFileInfo *fi);
    void open(QFileInfo *fi);

    void startListUpdate();
    void stopListUpdate();

    void registerRecent(const QString &filePath);

protected slots:
    void list_nameChanged();
    void list_numSourcesChanged(uint numSources);
    void list_modified();
    void list_updated(
        uint succeeded
    ,   uint failed
    ,   uint skipped);

private slots:
    void on_updateAction_triggered();
    void on_newAction_triggered();
    void on_exitAction_triggered();
    void on_appendItemAction_triggered();
    void on_removeItemAction_triggered();
    void on_appendWebSourceAction_triggered();
    void on_appendUserSourceAction_triggered();
    void on_removeSourceAction_triggered();
    void on_saveAction_triggered();
    void on_saveAsAction_triggered();
    void on_openAction_triggered();
    void on_recentFilesMenu_triggered(QAction *action);

protected:
    Ui::MainWindow *ui;

    List *m_list;

    QFileInfo *m_file;
    bool m_modified;

    QMap<QString, QAction*> m_recentActionsByFilePath;
};

#endif // MAINWINDOW_H
